package com.sise.thread.FutureModel;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.FutureTask;

/**
 * 作者：idea
 * 日期：2018/6/21
 * 描述：多线程里面的future模式
 */
public class FutureModel {
    public static void main(String[] args) throws InterruptedException, ExecutionException {
        FutureTask<String> futureTask=new FutureTask<String>(new RealData("*"));
        ExecutorService executorService= Executors.newFixedThreadPool(1);
        executorService.submit(futureTask);
        System.out.println("请求完毕了");
        Thread.sleep(200);
        System.out.println("真实数据"+futureTask.get());
    }
}
